# coding=utf-8
from MimicryHoneypot import *
from random import randint
import joblib
class RandomEvolver:
    __honeypot  = None
    config_file_storage_path = '/etc/vsftpd/vsftpd_configs.pkl'
    def __init__(self,honeypot):
        self.__honeypot = honeypot
    def step(self):
        action_space_len = self.__honeypot.action_space_len
        action_index = randint(0,action_space_len - 1)
        self.__honeypot.step(action_index)
        ip,configs = self.__honeypot.getCurrentConfig()
        last_state = {
            "ip":ip,
            "configs":configs
        }
        joblib.dump(last_state,self.config_file_storage_path)


